package com.czxy.dem01;

import java.lang.reflect.Field;

public class Test25 {

    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException {

        Class<?> aClass = Class.forName("com.czxy.dem01.Apple");
        Field appleName = aClass.getDeclaredField("appleName");
        appleName.setAccessible(true);
        if (appleName.isAnnotationPresent(FruitName.class)) {
            FruitName annotation = (FruitName) aClass.getAnnotation(FruitName.class);
            System.out.println(annotation.value());
        }

    }
}




